1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.48">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 29.0px; text-indent: -29.0px; font: 12.0px Helvetica
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 29.0px; font: 12.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; font: 12.0px Helvetica
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 86.0px; font: 12.0px Helvetica
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #007300}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf}
24 span
.s1
{color: #0000bf}
25 span
.s2
{color: #007300}
26 span
.s3
{color: #000000}
27 span
.s4
{font: 12.0px Helvetica
; text-decoration: underline
}
28 span
.Apple-tab-span
{white-space:pre
}
32 <p class=
"p1"><b>Pitch and rhythm conversions in the default event
</b></p>
33 <p class=
"p2"><br></p>
34 <p class=
"p3">Using the default event prototype, pitch and rhythm can be specified in Pbind at different levels depending on the musical requirement. The default event prototype includes logic to convert higher-level abstractions into the physical parameters that are useful for synthesis.
</p>
35 <p class=
"p2"><br></p>
36 <p class=
"p3">The descriptions below start with the ending value that will actually be used, following up with the other values that are used in the calculations: e.g., \delta is based on \dur and \stretch. The calculations may be bypassed by providing another value for the calculated item. If your pattern specifies \delta directly, \dur and \stretch are ignored.
</p>
37 <p class=
"p2"><br></p>
38 <p class=
"p3">Note also that there is no obligation to use these constructs. The default event prototype is not meant to enforce one model of pitch or rhythm over any other; it simply provides these options, which you may use if they suit the task, or ignore or override if your task calls for something else entirely.
</p>
39 <p class=
"p2"><br></p>
40 <p class=
"p4"><b>Timing conversions
</b></p>
41 <p class=
"p2"><br></p>
42 <p class=
"p3">Rhythm is based on \delta and \sustain event keys. Both of these can be calculated from higher-level abstractions: \dur, \stretch and \legato.
</p>
43 <p class=
"p2"><br></p>
44 <p class=
"p3"><b>delta:
</b> The number of beats until the next event. You can give the delta pattern directly, or the default event prototype can calculate it for you based on other values:
</p>
45 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>dur:
</b> Duration of this event.
</p>
46 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>stretch:
</b> A multiplier for duration:
<i>delta = dur * stretch
</i>.
</p>
47 <p class=
"p2"><br></p>
48 <p class=
"p3"><b>sustain:
</b> How many beats to hold this note. After \sustain beats, a release message will be sent to the synth node setting its 'gate' control to
0. Your SynthDef should use 'gate' in an
<a href=
"../../UGens/Synth control/Envelopes/EnvGen.html"><span class=
"s1">EnvGen
</span></a> based on a sustaining envelope (see
<a href=
"../../Control/Env.html"><span class=
"s1">Env
</span></a>), and the EnvGen should have a doneAction (
<a href=
"../../UGens/Synth control/Envelopes/UGen-doneActions.html"><span class=
"s1">UGen-doneActions
</span></a>) that releases the synth at the end. You can give the sustain pattern directly, or the default event prototype can calculate it for you based on:
</p>
49 <p class=
"p5"><span class=
"Apple-tab-span"> </span><b>legato:
</b> A fraction of the event's duration for which the synth should sustain.
1.0 means this synth will release exactly at the onset of the next;
0.5 means the last half of the duration will be a rest. Values greater than
1.0 produce overlapping notes.
<i>sustain = dur * legato * stretch
</i>.
</p>
50 <p class=
"p2"><br></p>
51 <p class=
"p4"><b>Pitch conversions
</b></p>
52 <p class=
"p2"><br></p>
53 <p class=
"p3">Pitch handling in the default event is rich, with a large number of options. To use events, it is not necessary to understand all of those options. As the examples have shown, a note-playing pattern produces sensible results even specifying only 'degree'. The other parameters allow you to control how the event gets from \degree to the frequency that is finally passed to the new synth. The default event prototype includes reasonable defaults for all of these.
</p>
54 <p class=
"p2"><br></p>
55 <p class=
"p3">To go from the highest level of abstraction down:
</p>
56 <p class=
"p2"><br></p>
58 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><b>\degree
</b> represents a scale degree. Fractional scale degrees support accidentals: adding
0.1 to an integer scale degree raises the corresponding chromatic note number by a semitone, and subtracting
0.1 lowers the chromatic note number.
0.2 raises or lowers by two semitones, and so on.
</li>
59 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><b>\note
</b> is a chromatic note index, calculated from \degree based on a
<b>\scale
</b> and modal transposition (
<b>\mtranspose
</b>, scale degrees to raise or lower the note).
<b>\note
</b> is in equal-tempered units of any number of steps to the octave (
<b>\stepsPerOctave
</b>).
</li>
60 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><b>\midinote
</b> is a
12ET conversion of
<b>\note
</b>, transposed into the right
<b>\octave
</b> and applying gamut transposition (
<b>\gtranspose
</b>, given in stepsPerOctave units). If \stepsPerOctave is anything other than
12, the non-
12ET units are scaled into
12 \midinote units per octave.
</li>
61 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><b>\freq
</b> is calculated from \midinote by 'midicps'. A chromatic transposition in
12ET units (
<b>\ctranspose
</b>) is added.
</li>
63 <p class=
"p2"><br></p>
64 <p class=
"p3">Most note-playing SynthDefs use 'freq' as an argument. If desired, they may use 'midinote', 'note' or even 'degree'.
</p>
65 <p class=
"p2"><br></p>
66 <p class=
"p3">To simplify into rules of thumb:
</p>
67 <p class=
"p2"><br></p>
69 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">If your material is organized around scales or modes, use
<b>\degree
</b>.
</li>
71 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">If the scale has different ascending and descending patterns, use
<b>\note
</b> in your Pbind, with the filter pattern
<a href=
"../Patterns/Pavaroh.html"><span class=
"s1">Pavaroh
</span></a>.
</li>
73 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">If your material is organized around equal divisions of the octave (not necessarily
12 divisions), use
<b>\note
</b> (and
<b>\stepsPerOctave
</b> for equal temperament other than
12 notes).
</li>
74 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">If your material is organized around MIDI note numbers (or
12-tone equal temperament),
<b>\midinote
</b> will also work.
</li>
75 <li style=
"margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">If you prefer to give frequencies directly in Hz, use
<b>\freq
</b>.
</li>
77 <p class=
"p2"><br></p>
78 <p class=
"p3">Following is a complete description of all elements of the pitch system. Feel free to use the ones that are of interest, and ignore the rest.
</p>
79 <p class=
"p2"><br></p>
80 <p class=
"p3"><b>freq:
</b> Frequency in Hz. May be given directly, or calculated based on the following. Pitch may be expressed at any one of several levels. Only one need be used at a time. For instance, if you write pitch in terms of scale degrees, the note, MIDI note and frequency values are calculated automatically for you.
</p>
81 <p class=
"p6"><b>ctranspose:
</b> Chromatic transposition, in
12ET units. Added to midinote.
</p>
82 <p class=
"p6"><b>midinote:
</b> MIDI note number;
12 MIDI notes = one octave. This may be fractional if needed. Calculated based on:
</p>
83 <p class=
"p7"><b>root:
</b> The scale root, given in
12ET MIDI note increments.
</p>
84 <p class=
"p7"><b>octave:
</b> The octave number for 'note' =
0. The default is
5, mapping note
0 onto MIDI note
60.
</p>
85 <p class=
"p7"><b>stepsPerOctave:
</b> How many 'note' units map onto the octave. Supports non-
12ET temperaments.
</p>
86 <p class=
"p7"><b>gtranspose:
</b> Non-
12ET transposition, in 'note' units. Added to note.
</p>
87 <p class=
"p7"><b>note:
</b> The note number, in any division of the octave.
0 is the scale root. Calculated based on:
</p>
88 <p class=
"p8"><b>degree:
</b> Scale degree.
</p>
89 <p class=
"p8"><b>scale:
</b> Mapping of scale degrees onto semitones. Major, for instance, is [
0,
2,
4,
5,
7,
9,
11].
</p>
90 <p class=
"p8"><b>stepsPerOctave:
</b> (Same as above.)
</p>
91 <p class=
"p8"><b>mtranspose:
</b> Modal transposition; added to degree.
</p>
92 <p class=
"p2"><br></p>
93 <p class=
"p3">See also the
<a href=
"../../Collections/Scale.html"><span class=
"s1">Scale
</span></a> class for a repository of scale configurations, and the possibility of non-ET tuning.
</p>
94 <p class=
"p2"><br></p>
96 <p class=
"p10">// approximate a major scale with a
19TET chromatic scale
</p>
97 <p class=
"p9">p =
<span class=
"s1">Pbind
</span>(
</p>
98 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s2">\scale
</span>, #[
0,
3,
6,
8,
11,
14,
17],
</p>
99 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>\stepsPerOctave
<span class=
"s3">,
19,
</span></p>
100 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s2">\degree
</span>,
<span class=
"s1">Pwhite
</span>(
0,
7,
<span class=
"s1">inf
</span>),
</p>
101 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s2">\dur
</span>,
0.125,
</p>
102 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s2">\legato
</span>,
<span class=
"s1">Pexprand
</span>(
0.2,
6.0,
<span class=
"s1">inf
</span>)
</p>
103 <p class=
"p9">).play;
</p>
105 <p class=
"p12"><br></p>
106 <p class=
"p9">p.stop;
</p>
107 <p class=
"p2"><br></p>
108 <p class=
"p2"><br></p>
109 <p class=
"p4"><b>Amplitude conversion
</b></p>
110 <p class=
"p2"><br></p>
111 <p class=
"p3">Finally, you can specify amplitude as
<b>\db
</b> or
<b>\amp
</b>. If it's given as \db, the amplitude will be calculated automatically using .dbamp.
</p>
112 <p class=
"p2"><br></p>
113 <p class=
"p2"><br></p>
114 <p class=
"p13"><span class=
"s3">Previous:
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><a href=
"PG_06g_Data_Sharing.html"><span class=
"s4">PG_06g_Data_Sharing
</span></a></span></p>
115 <p class=
"p14"><span class=
"s3">Next:
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><a href=
"PG_08_Event_Types_and_Parameters.html"><span class=
"s4">PG_08_Event_Types_and_Parameters
</span></a></span></p>